import {createStore} from 'vuex'

export default createStore({
    state: {
        number: 2
    },
    mutations: {
        SET_NUMBER(state, value) {
            state.number = value
        }
    },
    actions: {
        setNumber({commit}, value) {
            commit('SET_NUMBER', value)
        }
    },
    getters: {
        mynumber: (state) => state.number * state.number
    },
    modules: {
        a: {
            state: {
                aa: 11
            },
            mutations: {
                SET_AA(state, value) {
                    state.aa = value
                }
            },
            actions: {}
        }
    }
})
